package yxy.cherry.battle.module.affix.buff;

import yxy.cherry.battle.Battle;
import yxy.cherry.battle.Fighter;
import yxy.cherry.battle.module.affix.AffixFactory.BuffTypeEnum;
import yxy.cherry.battle.module.affix.Buff;
import yxy.cherry.battle.module.affix.BuffType;
import yxy.cherry.battle.module.record.stream.RecordStream;
import yxy.cherry.battle.module.record.stream.RecordStream_26_DOT灼烧;
import yxy.cherry.battle.module.record.stream.RecordStream_BUF;
import yxy.cherry.data.bean.skill;

/**
 *  灼烧(以施法者的攻击作为基础计算值)
 *
 */
@BuffType(Type = BuffTypeEnum.灼烧)
public class Affix_52_灼烧 extends Buff {

	long 跳血值 = 0;

	// 参数1: 施法放攻击比例
	private int get殒血比例() {
		return getParam(0);
	}

	public Affix_52_灼烧(Fighter source, Fighter target, skill skilldata, int[] params) {
		super(source, target, skilldata, params);
		跳血值 = source.get攻击() * get殒血比例() / VALUE_比率分母;
	}

	@Override
	public RecordStream record() {
		return getRecord().stream(new RecordStream_BUF(getActor(), getActor().getBuffMap().get(this.getBuffCodeSeq())));
	}

	@Override
	public boolean exec(Fighter source, Fighter target) {
		if (!target.is活着()) {
			return false;
		}

		target.set伤害(跳血值);

		// 流脚本
		getRecord().stream(new RecordStream_26_DOT灼烧(source, target, 跳血值)).record();

		// 统计
		getRecord().get统计().getFighter(source.getFighterPosition()).addDMG(跳血值);
		getRecord().get统计().getFighter(target.getFighterPosition()).addHUT(跳血值);

		if (!target.is活着()) {
			target.handle本方有死将();
		}

		Battle.battleLogger(6,"灼烧：灼烧者"+target.getName() +"目标攻击"+source.get攻击()+"殒血比例"+get殒血比例()+"受到伤害 " + 跳血值);
		return true;
	}

	@Override
	public BuffType getBuffType() {
		return BuffType.DOT效果;
	}

	@Override
	public BuffStateType getBuffStateType() {
		return BuffStateType.灼烧状态;
	}

}